<template>
  <div>
    <el-card style="max-width: 480px">
      <template #header>
        <span class="card-title">欢迎回来，{{ username }}</span>
      </template>
      <img :src="imgUrl" style="width: 100%" />
    </el-card>
  </div>
</template>

<script setup>
import axios from "axios";
import { onMounted } from "vue";
import { ref } from "vue";

let username = ref("");
let imgUrl = ref("");
const getInfo = async () => {
  const { code, data } = await axios.get("/admin/getInfo");
  if (code === 200) {
    username.value = data.username;
    imgUrl = `http://localhost:3000/${data.avater}`;
  }
};

onMounted(() => {
  getInfo();
});
</script>
